package com.mzj.saas.mservice.home.controller;

import com.mzj.saas.commons.ResultBean;
import com.mzj.saas.mservice.home.service.HomeService;
import com.mzj.saas.mservice.house.vo.HousePublicityVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Controller
@RequestMapping("/home")
public class HomeController {
    private static final Logger LOG = LoggerFactory.getLogger(HomeController.class);
    @Autowired
    private HomeService homeService;

    /*
     *公告展示
     */
    @PostMapping(value = "companyAdvertShow")
    @ResponseBody
    public ResultBean<Object> companyAdvertShow(@RequestHeader String accessToken, @RequestParam(name = "type", required = false) List<Integer> type, @RequestParam(defaultValue = "0") Integer pageNumber,
                                                @RequestParam(defaultValue = "10") Integer pageSize) {
        return homeService.companyAdvertShow(accessToken, type, pageNumber, pageSize);
    }

    /**
     * 获取公示明细数据
     *
     * @param accessToken
     * @return
     */
    @RequestMapping(value = "/housePublicity", method = RequestMethod.GET)
    @ResponseBody
    public ResultBean<Object> housePublicity(@RequestHeader String accessToken,
                                             @RequestParam(defaultValue = "0") Integer pageNumber,
                                             @RequestParam(defaultValue = "10") Integer pageSize,
                                             HousePublicityVO vo) {

        return homeService.housePublicity(accessToken, pageNumber, pageSize, vo);
    }

    /*
     *首页企业信息展示
     */
    @PostMapping(value = "companyInformationShow")
    @ResponseBody
    public ResultBean<Object> companyInformationShow(@RequestHeader String accessToken) {
        return homeService.companyInformationShow(accessToken);
    }
}
